﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Enterprise.Model.ZhiWu;
using Enterprise.DataFactory;
using Enterprise.Infrastructure;
using Microsoft.Practices.EnterpriseLibrary.Data;
namespace Enterprise.Data.ZhiWu
{
    public class UserZhiwuData
    {
        /// <summary>
        ///  用户职务对应关系数据列表
        /// </summary>
        /// <returns></returns>
        public List<UserZhiwuEntity> List()
        {
            List<UserZhiwuEntity> list = new List<UserZhiwuEntity>();
            string cmd = "Select * from SYS_USERZHIWU";
            IDataReader dr = DbExecute.DataReader(cmd);
            while (dr.Read())
            {
                UserZhiwuEntity entity = new UserZhiwuEntity();
                if (!Convert.IsDBNull(dr["UZID"])) entity.UZID = Convert.ToInt32(dr["UZID"]);
                if (!Convert.IsDBNull(dr["ZWID"])) entity.ZWID = Convert.ToInt32(dr["ZWID"]);
                if (!Convert.IsDBNull(dr["USERID"])) entity.USERID = Convert.ToInt32(dr["USERID"]);
                list.Add(entity);
            }
            dr.Close();
            return list;
        }

        /// <summary>
        /// 操作方法
        /// </summary>
        /// <param name="cmd"></param>
        public void Execute(string cmd)
        {
            DbExecute.Execute(cmd);
        }

        /// <summary>
        /// 返回数据集合
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        public DataSet ExcuteDataSet(string cmd)
        {
            return DbExecute.GetDataSet(cmd);
        }
    }
}
